//
// Created by 17775 on 2024/11/11.
//

#ifndef RAYCI_COMMONCHART_H
#define RAYCI_COMMONCHART_H

#include <QWidget>
#include "../qcustomplot.h"


QT_BEGIN_NAMESPACE
namespace Ui { class CommonChart; }
QT_END_NAMESPACE

class CommonChart : public QWidget {
Q_OBJECT

signals:
    void showOptions();

public:
    explicit CommonChart(QWidget *parent = nullptr);
    ~CommonChart() override;
    void setData();
    void setName(QString name);
    void setLabel(QString xLabel, QString yLabel);
    void setYLabel(QString yLabel);
    void setXLabel(QString xLabel);
    void setTitle(QString titleName);
    void setRange();

    QCustomPlot* getCustomPlot();

    QCPGraph* getGraph();
    void freshChart();
    void clearChart();

private:
    Ui::CommonChart *ui;
    QCustomPlot *customPlot = nullptr;
    QCPTextElement *title = nullptr;
    QMenu *m_contextMenu = nullptr;
    QCPGraph* intensityGraph=nullptr;
};


#endif //RAYCI_COMMONCHART_H
